" default dpi is 100 (possible are 75/100/150/300)\n"
" default printer is /dev/lp\n"
" -rev, reverse black and white on the print out\n"
" -display only displays the image to the screen and does not print it\n"
" all ither options will be ignored\n"
" -2bmp converts the image X window dump to a MicroSoft Windows bitmap (BMP)\n"
" the file written to must be specified by -dev [filename]\n"
" all other options will be ignored\n"
" -land prints the image in landscape mode (sideways)\n"
" filename is the name of the dump created by xwd\n"
" Using Dos, the command [%s -dev lpt1] should be used\n",argv[0],argv[0]);
exit(0);
}
im=readxwd(fname,pal);
if (!im || !pal)
{ printf("failed to read the image or the palette!\n");
exit(0);
}
if (display)
{
set_mode(19,argc,argv);
pal->load(); // set the palette for the image we are going to print
im->put_image(screen,0,0); // put the image on thge s÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷<0) yo+=10; break;
}
} while (ch!=' ' && ch!='q' && ch!=13);
close_graphics();
}
else if (bmp)
write_bmp(im,pal,dev_name);
else
{
fp=fopen(dev_name,"wb"); // open the output device for printing
if (!fp)
{ printf("Unable to open %s for writing, make sure the path exsist and you\n"
"have write permission to the file\n",dev_name);
exit(0);
}
if (land)
im=rotate90(im);
w=im->width()+7; w/=8; w*=8;
fprintf(fp,"E" // reset the printer
"&l%dO" // portrait/landscape mode
"*rbC" // reset graphics
"*t%dR" // set the resolution
"*r%dS" // set the image width
"*r1A" // start raster graphics at left edge
"*r-4U" // set to CYM mode
,land,dpi,w);
// now loop through all the scan lines of the image and pcik out the planes
// we need
i24=color_dither(im,pal,rev);
rev=0; // turn off the revser option because the conversion to 24 bit takes care of it
printf("Printing...");
for (y=0;y<im->height();y++)
{
if (y%20==0)
printf(".");
sl=i24->scan_line(y);
//initally set all the planes to clear, this should leave the paper white